/*
 * @Author: ChunLai
 * @Date: 2022-01-04 20:49:25
 * @LastEditTime: 2025-08-22 09:57:23
 * @Description: 网销版简易告知
 * @FilePath: \02.bldinsure\src\views\healthy\simple\mixin.js
 */
export const simpleMixin = {
  data() {
    return {
      pageData: [],
      notifyMsg: {},
      activeIndex: 0,
    };
  },
  computed: {
    isShareHealthy() {
      let res = false;
      if (this.$getDataFromUrl("share") == "1") {
        res = true;
      }
      return res;
    },
    tipMsg() {
      let res = `我已如实告知健康情况，并清楚知道若实际情况一告知内容不符，保险公司有权解除保险合同，且对保险合同解除前发生的事故，保险公司不承担赔偿或给付保险金责任。`;
      if (this.notifyMsg.topTip) {
        res = this.notifyMsg.topTip;
      }
      return res;
    },
    noticeLen() {
      let res = 0;
      if (this.pageData.length > 0) {
        res = this.pageData.length;
      }
      return res;
    },
    noticeObj() {
      let res = {};
      if (this.activeIndex <= this.noticeLen - 1) {
        res = this.pageData[this.activeIndex];
      }
      return res;
    },
  },
  methods: {
    initPageDatas() {
      this.$store.dispatch("json/getNoticeJson", "simple").then(async (res) => {
        let { Datas, ...newObj } = res;
        this.pageData = JSON.parse(JSON.stringify(Datas));
        // if(this.pageData.length === 1){
        //   document.title = `${this.userNick}${this.pageData[0].moduleName}`
        // }
        this.notifyMsg = newObj;
      });
    },
  },
};
